'use client';
import { useRouter } from 'next/navigation';
import React from 'react';
import './topbar.css';

interface MainNavBarProps {
  leftIcon?: React.ReactNode;
  title: string;
}

export default function MainNavBar({ leftIcon, title }: MainNavBarProps) {
  const router = useRouter();

  return (
    <div className="header">
      {leftIcon && (
        <span onClick={() => router.back()} className="leftIcon">
          {leftIcon}
        </span>
      )}
      <p className="headerText">{title}</p>
    </div>
  );
}